% function to convert 
% julian date to dd mm yy format
% original Java script at http://skye.as.arizona.edu/~turnbull/JD-calendar.html

% latest date 27.11.2002

function[K,J,I] = jd2dmy(JD),

    IJD = floor(JD);
    L = floor(IJD + 68569);
    N = floor(4 * L / 146097);
    L = L - floor((146097*N + 3)/4);
    I = floor(4000*(L + 1)/1461001);
    L = L - floor(1461 * I / 4) + 31;
    J = floor(80 * L / 2447);
    K = L - floor(2447 * J / 80);
    L = floor(J/11);
    J = J + 2 - 12*L;
    I = 100*(N - 49) + I + L;
